Adding some more judges, here and there.
[and.git] / UVa / 10310 - Dog and Gopher / p10310.cpp
blob14b83e5cd58869278be756519c6472400484e2c8
1 #include <iostream>
2 #include <math.h>
4 using namespace std;
6 int main(){
7 int n;
8 double gx, gy, dx, dy;
9 while (cin >> n >> gx >> gy >> dx >> dy){
10 bool escaped = false;
13 for (int i=0; i<n; ++i){
15 double hx, hy;
16 cin >> hx >> hy;
17 if (!escaped){
18 double d, g;
19 g = sqrt(pow(gx - hx,2)+pow(gy - hy,2));
20 d = sqrt(pow(dx - hx,2)+pow(dy - hy,2));
21 if (g*2 <= d){
22 escaped = true;
23 printf("The gopher can escape through the hole at (%.3f,%.3f).\n", hx, hy);
27 if (!escaped) cout << "The gopher cannot escape.\n";
31 return 0;